package control

import (
	"admin/src/log"
	"admin/src/res"
	"admin/src/utils"

	"github.com/gin-gonic/gin"
	"go.uber.org/zap"
)

type KeyController struct{}

func (k *KeyController) GetPublicKey(c *gin.Context) {
	pubKey, err := utils.LoadPublicKey("key/public.pem")
	if err != nil {
		res.ErrorMsg(c, err.Error())
		log.Logger.Error("", zap.Error(err))
		return
	}
	res.Ok(c, pubKey)
}
